<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html lang="en">

<head>
    <%@ include file="/WEB-INF/admin/common/base.jsp" %>
    <jsp:include page="/WEB-INF/admin/common/head.jsp"/>
    <link type="text/css" href="<%=basePath%>static/syntaxhighlighter_3.0.83/styles/shCore.css"/>
    <link type="text/css" href="<%=basePath%>static/syntaxhighlighter_3.0.83/styles/shThemeDefault.css"/>
    <title>发布文章</title>
</head>

<body>
<div id="wrapper">
    <!-- Navigation -->
    <jsp:include page="/WEB-INF/admin/common/navi.jsp"/>

    <div id="page-wrapper" style="min-height: 491px;">
        <div class="row">
            <div class="col-lg-12">
                <h1 class="page-header">发布文章</h1>
            </div>
            <!-- /.col-lg-12 -->
        </div>
        <!-- /.row -->
        <div class="row">
            <div class="col-lg-12">
                <div class="panel panel-primary">
                    <div class="panel-heading">
                        ${id==null?"发布":"修改"}文章
                    </div>
                    <div class="panel-body">

                        <c:if test="${!empty errors}">
                            <div class="form-group has-error">
                                <c:forEach items="${errors}" var="error">
                                    <label class="control-label">${error}</label><br>
                                </c:forEach>
                            </div>
                        </c:if>

                        <div class="row">
                            <div class="col-lg-12">
                                <form role="form" action="<%=adminBasePath%>post/postAddOrUpdate" method="post">
                                    <div class="form-group">
                                        <input type="hidden" name="id" value="${record.id}">
                                        <input class="form-control" name="title" placeholder="请输入标题" value="${record.title}">
                                    </div>
                                    <div class="form-group">
                                        <textarea class="form-control" name="content" id="content" rows="3">${record.content}</textarea>
                                    </div>
                                    <div class="form-group">
                                        <label>摘要</label>
                                        <textarea class="form-control" name="excerpt" rows="3">${record.excerpt}</textarea>
                                    </div>
                                    <div class="form-group">
                                        <label>父类别</label>
                                        <select class="form-control" name="categoryId">
                                            <option value="0">无</option>
                                            <c:forEach items="${categorys}" var="cate">
                                                <option value="${cate.id}"
                                                        <c:if test="${cate.id==record.category_id}">selected</c:if>>
                                                        ${cate.name}
                                                </option>
                                            </c:forEach>
                                        </select>
                                    </div>
                                    <div class="form-group">
                                        <label>允许评论</label>
                                        <input name="commentStatus" type="checkbox" id="comment_status" value="1"
                                               <c:if test="${record.comment_status}">checked="checked"</c:if>>
                                    </div>

                                    <button type="submit" class="btn btn-default">提交</button>
                                    <button type="reset" class="btn btn-default">重置</button>
                                </form>
                            </div>
                            <!-- /.col-lg-6 (nested) -->

                            <!-- /.col-lg-6 (nested) -->
                        </div>
                        <!-- /.row (nested) -->
                    </div>
                    <!-- /.panel-body -->
                </div>
                <!-- /.panel -->
            </div>
            <!-- /.col-lg-12 -->
        </div>
        <!-- /.row -->
    </div>
</div>
<!-- /#wrapper -->

<jsp:include page="/WEB-INF/admin/common/bottom.jsp"/>
<script src="<%=basePath%>static/jquery-validation/jquery.validate.js"></script>
<script src="<%=basePath%>static/kindeditor-4.1.10/kindeditor.js"></script>
<script src="<%=basePath%>static/kindeditor-4.1.10/lang/zh_CN.js"></script>
<script src="<%=basePath%>static/syntaxhighlighter_3.0.83/scripts/shCore.js"></script>
<script src="<%=basePath%>static/syntaxhighlighter_3.0.83/scripts/shBrushJava.js"></script>
<script src="<%=basePath%>static/syntaxhighlighter_3.0.83/scripts/shAutoloader.js"></script>
<script src="<%=basePath%>static/js/admin/post/postView.js"></script>

</body>
</html>
